<?php

namespace App\Http\Controllers;

use App\Services\OssService;
use Illuminate\Http\Request;

class FileController extends Controller
{
    protected $ossService;

    public function __construct(Request $request, OssService $ossService)
    {
        $this->ossService = $ossService;
        parent::__construct($request);
    }

    public function uploadUserHeadPic(Request $request)
    {
        $file = $request->file('img');
        $fileName = $file->getClientOriginalName();
        $upload = $this->ossService->uploadPic($file, $fileName, 'head/pic');
        return renderSuccessJson($upload);
    }
}
